package com.jml.waitnotify;

import com.jml.手写数据库连接池.DbBean;
import java.util.concurrent.atomic.AtomicInteger;
import org.junit.Test;

public class Test001 {

	AtomicInteger integer = new AtomicInteger(0);

	public synchronized void twait() throws InterruptedException {
			System.out.println("-------------------");
			int i = integer.incrementAndGet();
			System.out.println("count:"+i+"   "+Thread.currentThread().getName());
			if(i>1){
				return;
			}
			wait(6000);
			System.out.println("++++++++++++++");
	}

	public  void tnotifyAll() throws InterruptedException {
		System.out.println("-------00000------------"+integer.get() +"     "+Thread.currentThread().getName());
		notifyAll();
		System.out.println("++++++000000++++++++");
	}
}
